<?php

namespace App\Exceptions;

use Symfony\Component\HttpKernel\Exception\HttpException;

class AuthException extends AppException
{
    private int $statusCode = 401;

    public function __construct($message = '没有权限')
    {
        parent::__construct($message);
    }

    public function getHeaders(): array
    {
        return [
            'Content-Type' => 'application/json',
        ];
    }

    public function getStatusCode(): int
    {
        return $this->statusCode;
    }

    public function getError()
    {
        return ['code' => 'auth_error', 'message' => $this->getMessage()];
    }
}
